const Column = require('../../models/blog_column');

const ControllerHeader = {
    getColumnList: async function (req, res, next) {
        try {
            // let { per_page, page, } = req.query;
            // let pageSize = per_page ? per_page : 10;
            // let params = {};
            // let config = { pageSize, page };
            let list = [];

            // const columns = await Column.selectPaging(params, config);
            const columns = await Column.all();

            columns.forEach(item => {
                if (item.display == 1) list.push(item)
            })

            list.sort((a, b) => {
                return a.sort - b.sort
            })

            res.json({ code: 200, msg: '链接成功', data: { list } })
        } catch (e) {
            res.json({ code: 0, data: e })
        }
    }
}

module.exports = ControllerHeader;